import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

import iView from 'iview';
import net from '@/network/net.js';

import appRouter from '@/router/appRouter'
import menuRouter from '@/router/menuRouter'

const routers = [...appRouter,...menuRouter];

// 路由配置
const RouterConfig = {
  //mode: history,
  routes: routers
};

const router = new Router(RouterConfig);

/* eslint-disable */
router.beforeEach((to,from,next) => {
  iView.LoadingBar.start();
  net.title(to.meta.title);
  
  next();
});

router.afterEach(() => {
  iView.LoadingBar.finish();
  window.scroll(0,0);
  
});

export default router;